package com.luoye.lj.platform.controller;

import com.luoye.lj.platform.service.IMuserservice;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by wei on 2015/12/4.
 */
@Controller
@RequestMapping("/error")
public class ErrorController {
    private Logger logger = LoggerFactory.getLogger(ErrorController.class);

    @Resource
    private IMuserservice muservice;

    @InitBinder
    public void initBinder(WebDataBinder binder) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
        dateFormat.setLenient(false);
        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
    }

    @RequestMapping("/{errorNo}")
    public String toError(@PathVariable("errorNo")String errorNo){
        return "error/"+errorNo;
    }

}
